import { getCookieFromStorage } from '@/common/js/cookieHelper'

export const getUserInfo = () => {
  const jwtToken = getCookieFromStorage('PCRS_JWT_ACCESS_TOKEN').cookieValue
  if (jwtToken !== null && jwtToken.length > 0) {
    let payload = jwtToken.split('.')[1]
    let payloadData = JSON.parse(window.atob(payload))
    return payloadData.userInfo
  }
}

export default {
  getUserInfo: getUserInfo
}
